<template>
  <el-form-item :prop="prop" :label="label">
    <el-date-picker v-bind="$attrs" type="datetime" v-model="modelValue" :disabled="!isEdit" clearable
      :empty-values="['']" :value-on-clear="''" :format="format" />
  </el-form-item>
</template>

<script lang="ts" setup>
// 简化表单中date-picker的代码
defineOptions({
  name: 'MkDatePicker'
})

const props = defineProps({
  prop: {
    type: String,
  },
  label: {
    type: String,
  },
  isEdit: {
    type: Boolean,
    default: true
  },
  format: {
    type: String,
    default: "YYYY-MM-DD HH:mm"
  },
})

const modelValue = defineModel()
</script>